<?php
/*
 * content : 错误类基类
 * Author  : Songyicong 
 * time    : 2018-04-17 14:50:10 
 * email   : m13726262373@163.com 
 */
namespace app\api\exception;
use think\Exception;

class BaseException extends Exception{

    //错误码
    public $code = 400;
    //错误标识
    public $errcode = 100000;
    //错误信息
    public $errmsg = "invalid parameters";
    public $shouldToClient = true;
    /**构造函数，接受一个关联数组 */
    public function __construct($params = []){
        if(!is_array($params))
            return;
        if(array_key_exists('code',$params))
            $this->code = $params['code'];
        if(array_key_exists('errmsg',$params))
            $this->errmsg = $params['errmsg'];
        if(array_key_exists('errcode',$params))
            $this->errcode = $params['errcode'];
        
    }

}